package edu.sctu.practice.class01.fengleilin.assign03.test02;

/**
 * Created by fll on 2015/10/22.
 */

/**
 * 该类为Cylinder类的子类，并实现Comparable接口
 */
public class ComparableCylinder extends Cylinder implements Comparable {


    public ComparableCylinder(double r, double PI, double height) {
        super(r, PI, height);
    }

    /**
     * 比较圆柱的大小
     * @param o
     * @return
     */
    @Override
    public double compareTo(Object o) {

        double cylinderArea = 2 * PI * r * r + 2 * PI * r * height;
        System.out.println(cylinderArea);
        return cylinderArea;
    }
}
